package com.hz.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/text")
public class TextController {

    @Autowired
    private RedisTemplate redisTemplate;


    @RequestMapping("redis")
    public String redistext() {

        redisTemplate.opsForList().leftPush("username", "张三");
        redisTemplate.opsForList().leftPush("username", "李四");


        System.out.println(redisTemplate.opsForList().range("username", 0, -1));
        redisTemplate.opsForList().leftPush("username", "王五");
        System.out.println(redisTemplate.opsForList().range("username", 0, -1));
        redisTemplate.opsForList().rightPush("username", "孙六");
        System.out.println(redisTemplate.opsForList().range("username", 0, -1));


        return "";
    }


}
